<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="white">
    <link rel="stylesheet" href="../dist/main.css">
</head>
<body>
<script src="../dist/main.js"></script>
<div id="zc">


    <div class="box">
        <input type="text" placeholder="姓名" id="relName">
        <input type="text" placeholder="MT5账号" id="mt5Login">
        <div class="mui-input-row">
            <input type="password" placeholder="请输入MT5密码" class="mui-input-password" id="pass">

        </div>
        <input type="text" placeholder="昵称" id="name" class="follower" style="display: none">
        <input type="text" placeholder="昵称（用于信号源发布名称）" id="name2" class="mower" style="display: none">
        <input type="text" placeholder="手机号" id="Phone">




        <div id="check">
            <i class="mui-icon mui-icon-checkmarkempty" style="display: none"></i>

        </div>
        <span class="read">阅读并且同意我们的 <a id="agreement">《用户使用协议》</a></span>
        <div class="btns">
            <button class="mui-btn mui-btn-warning" id="sureBinding">确定绑定</button>
            <button class="mui-btn mui-btn-warning mui-btn-outlined" id="cansel">取消</button>
        </div>


    </div>

</div>
<script>
    $("title").html(mt5Obj.title)
    var check=true;
    var bol=true;
    var type;
    if(window.location.search){
        if(window.location.search.split("?")[1]=="0"){
            sessionStorage.setItem("type",0);
            $(".mower").show();
        }else{
            sessionStorage.setItem("type",1);
            $(".follower").show();
        }
    }

    if(sessionStorage.getItem("type")=="0"){
        $(".mower").show();

    }else{
        $(".follower").show();

    }




    $("#logo").attr("src",mt5Obj.logo);

    //自定义选择框
    mui("body").on('tap','#check',function(){
        if(check){
            $(this).children().show();
            check=false;
        }else {
            $(this).children().hide();
            check=true;
        }

    })


    //绑定按钮
    mui("body").on('tap','#sureBinding',function(){
        var relName=$("#relName").val();
        var mt5Login=$("#mt5Login").val();
        var name;
        var phone=$("#Phone").val();
        var pass=$("#pass").val();
        var code=$("#code").val();
        if(sessionStorage.getItem("type")=="0"){
            name=$("#name2").val();

        }else{
            name=$("#name").val();

        }

        if(relName==""){

            mui.alert("姓名不能为空！")
        }
        else if(mt5Login==""){


        }
        else if(phoneGe(phone,$("#Phone"))){
            return false;
        }
        else if(pass=="" ){

            mui.alert("密码不能为空！")
        }
        else if(name=="" ){
            mui.alert("昵称不能为空！")

        }else if(name>7){

            mui.alert("昵称长度小于7！")
        }
       else if(bolWarn()){
            return false;
        }else if(check){
            mui.alert("请勾选用户使用协议")
        }
        else{
            $.ajax({
                url: mt5Obj.allUrl+"mt/user/binding/mt ",
                type:"post",
                data:{
                    realName:relName,
                    mtLogin:mt5Login,
                    name:name,
                    mobile:phone,
                    password:pass,
                    type:sessionStorage.getItem("type"),
                },
                success: function(data){
                    if(data.data==10010111){
                        mui.alert("请输入真实的MT5账号！");
                    }else if(data.data==100311111){
                        mui.alert("MT5密码错误！");
                    }else if(data.data==1){
                        mui.alert("该MT5账号已被绑定！");
                    }
                    else if(data.data==2){
                        mui.alert("您有MT5账号正在被审核中，审核通过后可再绑定新的MT5账号！");
                    }else{
                        mui.alert("您已提交绑定申请，工作人员会尽快处理，请耐心等待。",function(e) {
                            if(e.index == 0) {
                                goUrl("mowList","1");
                            }
                        });
                    }
                }
            });
        }


    })


    //点击用户协议
    mui("body").on('tap','#agreement',function(){
        mui.openWindow({
            id:'agreement',
            url:'agreement2.html'
        });

    })
    goLogin()
    removeWarn()
//    取消
    mui("body").on('tap','#cansel',function(){
       goUrl("mowList","1")

    })

</script>

</body>
</html>


